package org.rambadger.command.event;

import org.hibernate.validator.constraints.Length;
import org.rambadger.command.validation.UrlIdentifier;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * Event representing a change of non-email profile fields for a {@link org.rambadger.command.model.UserAggregate User}
 */
public class UserProfileChanged implements Serializable {
    private static final long serialVersionUID = -31951885104929287L;

    private final String username;
    private final String firstName;
    private final String lastName;

    /**
     * Instantiates a new User profile changed.
     *
     * @param username the username/id
     * @param firstName the new first name
     * @param lastName the new last name
     */
    public UserProfileChanged(String username, String firstName, String lastName) {
        this.username = username;
        this.firstName = firstName;
        this.lastName = lastName;
    }

    /**
     * Gets username.
     *
     * @return the username
     */
    @UrlIdentifier @NotNull
    public String getUsername() {
        return username;
    }

    /**
     * Gets the new first name.
     *
     * @return the new first name
     */
    @Length(max = 32) @NotNull
    public String getFirstName() {
        return firstName;
    }

    /**
     * Gets the new last name.
     *
     * @return the new last name
     */
    @Length(max = 32) @NotNull
    public String getLastName() {
        return lastName;
    }

    @Override
    public String toString() {
        return "UserProfileChanged{" +
                "username='" + username + '\'' +
                ", firstName='" + firstName + '\'' +
                ", lastName='" + lastName + '\'' +
                '}';
    }
}
